﻿// <copyright file="WizardPageCollectionConverter.cs" company="DotNetLib">
//
// .netlib: http://www.codeplex.com/DotNetLib
//
// This code is released under the New BSD License.
// A copy of this license is available at:
// http://www.codeplex.com/DotNetLib/license
//
// </copyright>

namespace DotNetLib.Windows.Forms.Design
{
  using System;
  using System.ComponentModel;
  using System.Globalization;

  internal class WizardPageCollectionConverter : TypeConverter
  {
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
    {
      WizardPageCollection pages = (WizardPageCollection)value;
      if (pages.Count != 0)
      {
        if (pages.Count != 1)
        {
          return pages.Count + " pages";
        }
        else
        {
          return "1 page";
        }
      }
      else
      {
        return "Empty";
      }
    }
  }
}
